package com.example.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.springboot.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("SELECT * from user")
    List<User> findAll();
    @Insert("INSERT into user(uname,pwd) VALUES(#{uname},#{pwd})")
    int insert(User user);
    @Update("UPDATE user SET uname=#{uname},pwd=#{pwd} WHERE uname=#{uname}")
    boolean update(User user);
    @Delete("DELETE FROM user WHERE uname=#{uname}")
    Integer deleteByUname(@Param("uname")String uname);
    @Select("SELECT * from user where uname=#{uname}")
    List<User> findByUname(String uname);
    @Update("UPDATE user SET pwd=#{pwd} WHERE uname=#{uname}")
    int updatePwd(User user);
}
